package edu.hcmiu.portal.model;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;


public class user_Clp extends BaseModelImpl<user_> implements user_ {
    private long _userId;
    private String _screenName;

    public user_Clp() {
    }

    public long getPrimaryKey() {
        return _userId;
    }

    public void setPrimaryKey(long pk) {
        setUserId(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_userId);
    }

    public long getUserId() {
        return _userId;
    }

    public void setUserId(long userId) {
        _userId = userId;
    }

    public String getScreenName() {
        return _screenName;
    }

    public void setScreenName(String screenName) {
        _screenName = screenName;
    }

    public user_ toEscapedModel() {
        if (isEscapedModel()) {
            return this;
        } else {
            user_ model = new user_Clp();

            model.setEscapedModel(true);

            model.setUserId(getUserId());
            model.setScreenName(HtmlUtil.escape(getScreenName()));

            model = (user_) Proxy.newProxyInstance(user_.class.getClassLoader(),
                    new Class[] { user_.class }, new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        user_Clp clone = new user_Clp();

        clone.setUserId(getUserId());
        clone.setScreenName(getScreenName());

        return clone;
    }

    public int compareTo(user_ user_) {
        long pk = user_.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        user_Clp user_ = null;

        try {
            user_ = (user_Clp) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = user_.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{userId=");
        sb.append(getUserId());
        sb.append(", screenName=");
        sb.append(getScreenName());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("edu.hcmiu.portal.model.user_");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>userId</column-name><column-value><![CDATA[");
        sb.append(getUserId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>screenName</column-name><column-value><![CDATA[");
        sb.append(getScreenName());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
